package com.rtu.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * Created by ljf on 2018/4/15.
 */
public enum SDMappingEnum {
    HUANGJIA(1,"黄家埠镇",""),
    LINSHAN(2,"临山镇",""),
    SIMEN(3,"泗门镇",""),
    XIAOCAOE(4,"小曹蛾镇",""),
    MOUSHAN(5,"牟山镇",""),
    MAZHU(6,"马渚镇",""),
    LANGXIAJIE(7,"朗霞街道",""),
    DITANGJIE(8,"低塘街道",""),
    YANGMINGJIE(9,"阳明街道",""),
    LANJIANGJIE(10,"兰江街道",""),
    LIANGNONG(11,"梁弄镇",""),
    LIZHOUJIE(12,"梨洲街道","18000004"),
    FENGSHANJIE(13,"凤山街道",""),
    ZHANGTING(14,"丈亭镇",""),
    SANQISHI(15,"三七市镇",""),
    HEMUDU(16,"河姆渡镇","17120801"),
    LUBU(17,"陆埠镇",""),
    LUTING(18,"鹿亭乡",""),
    DALAN(19,"大岚镇",""),
    SIMINGSHAN(20,"四明山镇","17112701"),
    DAYIN(21,"大隐镇","");

    private int code;
    private String desc;
    private String deviceId;

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public String getDeviceId() {
        return deviceId;
    }

    SDMappingEnum(int code, String desc, String deviceId) {
        this.code = code;
        this.desc = desc;
        this.deviceId = deviceId;
    }

    public static String getDeviceId(int code) {
        SDMappingEnum[] enums = SDMappingEnum.values();
        for (SDMappingEnum sd : enums) {
            if (sd.getCode() == code) {
                if (StringUtils.isBlank(sd.getDeviceId())) {
                    return null;
                } else {
                    return sd.getDeviceId();
                }
            }
        }
        return null;
    }
}
